import bisect
from collections import Counter
import matplotlib.pyplot as plt
import numpy as np

init = 1602789302.265059
data = []
for line in open('fpm-batch-downup.log'):
    data.append(float(line.split(' - ')[1]) - init)

x = data
n = np.arange(1, len(x) + 1) / np.float(len(x))
Xs = np.sort(x)

print max(data)

# plt.figure()
fig, ax = plt.subplots(figsize=(6, 4))
ax.step(Xs, n)

ax.grid(True)
ax.legend(loc='right')
ax.set_title('CDF ospf batch link down then up')
ax.set_xlabel('Time(s)')
plt.savefig('%s.png' % "batch-downup-cdf")
plt.show()

